<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            text-align: center;
        }
        .box{
            width: 600px;
            height: 600px;
            background-color: pink;
            border: 2px dashed black;
            margin: auto;

        }
        .a{
            width: 400px;
            height: 30px;
       
        }
        button{
            background-color: blue;
            height: 25px;
            margin-left: 10px;
        }
        th,td{
            width: 200px;
            height: 60px;
        }
    </style>
</head>
<body>
          <h4>积云教育-全站</h4> 
        <div class="box">
            <table>
                <h2>任务记录</h2> 
           <input type="text" class="a"><button >添加</button>  
           <tr>
            <th>需要完成的任务</th>
            <th>时间</th>
            <th>操作</th>
           </tr>
           
            </table> 
        </div>


</body>
</html>
<script>
    var but=document.querySelector('button')
    var inp=document.querySelector('.a ')
    var table=document.querySelector('table')
    but.onclick=function(){
        var tr=document.createElement('tr')
        tr.innerHTML=`
            <td>${inp.value}</td>
            <td>${time()}</td>
            <td><button onclick='wc(this)'>完成</button><button onclick='sc(this)'>删除</button></td>
            `;
            table.appendChild(tr)
    }
    function time(){
       var date=new Date()
       return date.toLocaleDateString()
    }
    function sc(aaa){
        table.removeChild(aaa.parentNode.parentNode)
    }
    function wc(bbb){
         bbb.parentNode.style='line-through'
    }
</script>